import { createWebHashHistory, createRouter } from "vue-router";
import homeRouter from "./home";
import aboutRouter from "./about";
//优化性能：懒加载路由
// import login from "../views/login/index.vue";
// import Layout from "../views/Layout/index.vue";
// import Dashboard from "../views/Home/Dashboard/index.vue";
// import Banner from "../views/Home/Banner/index.vue";
// import AboutIndex from "../views/About/index/index.vue";
// import Contact from "../views/About/contact/index.vue";

const login = () => import("../views/login");
const NotFound = () => import("../views/NotFound/404");

const routes = [
  // 重定向
  { path: "/", redirect: "/login", hidden: true },
  { path: "/login", component: login, name: "login", hidden: true },
  homeRouter,
  aboutRouter,
  //...
  {
    path: "/:pathMatch(.*)*",
    name: "NotFound",
    component: NotFound,
    hidden: true,
  },
];
// export { routes };

const router = createRouter({
  history: createWebHashHistory(),
  routes,
});
export default router;
